package yc.gg.web.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import yc.gg.domain.req.CommentReq;
import yc.gg.domain.req.PostReq;
import yc.gg.domain.req.ReplyReq;
import yc.gg.service.IPostService;
import yc.gg.utils.Result;

import javax.annotation.Resource;

/**
 * \* User: Fuyue
 * \* Date: 2025/6/10
 * \* Description:
 * \
 */
@RestController
@RequestMapping("/api/post")
@Slf4j
public class PostController {
    @Resource
    IPostService postService;

    @PostMapping("/post")
    public Result post(@RequestBody PostReq postReq){return postService.post(postReq);}

    @GetMapping("/get")
    public Result get(int pageNum){return postService.get(pageNum);}

    @GetMapping("/get/{id}")
    public Result getById(@PathVariable String id) {return postService.getById(id);}

    @PostMapping("/comment")
    public Result comment(@RequestBody CommentReq commentReq){return postService.comment(commentReq);}

    @PostMapping("/commentList")
    public Result commentList(@RequestBody CommentReq commentReq){return postService.commentList(commentReq);}

    @PostMapping("/addReply")
    public Result addReply(@RequestBody ReplyReq replyReq){return postService.addReply(replyReq);}

    @GetMapping("/mine")
    public Result mine(){return postService.mine();}
}